import { defineStore } from "pinia";

export const useUserStore = defineStore("user", {
  state: () => {
    userInfo: null
  },
  actions: {
    login(userDetails) {
      return new Promise((resolve) => {
        setTimeout(() => {
          this.userInfo = { ...userDetails, isLoggedIn: true }
          resolve(this.userInfo);
        }, 1000)
      })
    },
    logout () {
      this.userInfo = null;
    }
  }
})